#include <LengthUnit.h>
#include <sstream>

const unsigned int MILE_TO_YARD    = 1760;
const unsigned int YARD_TO_FEET    = 3;
const unsigned int BASE_UNIT_VALUE = 1;

const LengthUnit* LengthUnit::getMileInstance()
{
    static LengthUnit mile("MILE", MILE_TO_YARD, YARD);
    return &mile;
}

const LengthUnit* LengthUnit::getYardInstance()
{
    static LengthUnit yard("YARD", YARD_TO_FEET, FEET);
    return &yard;
}

const LengthUnit* LengthUnit::getFeetInstance()
{
    static LengthUnit feet("FEET", BASE_UNIT_VALUE, 0);
    return &feet;
}

LengthUnit::LengthUnit(const std::string& name, unsigned int factor, const LengthUnit* refUnit)
    : Unit(name, factor, refUnit)
{
}

const LengthUnit* LengthUnit::nextUnit() const
{
    return (LengthUnit*)Unit::nextUnit();
}
